ds_priority_read

从字符串中读取优先级队列数据结构。

语法:

ds_priority_read(id, str [, legacy]);


参数 描述
id 要写入的数据结构的id。
str 要写的字符串。
legacy (optional) 可以是 truefalse 或完全省略。


返回: N/A(无返回值)


描述

使用此功能,您可以重新创建已保存的ds_priority(需是之前使用ds_priority_write写成字符串的)。您必须首先创建一个新的ds_priority来读取字符串,如果ds_priority已经存在且信息存储在其中,那么在读取之前将清除原来的。在为游戏创建保存/加载机制时,此功能至关重要。请注意,如果数据结构是使用以前的版本创建的GameMaker你应该添加可选参数“legacy”,将其设置为true,因为此版本的字符串格式已更改。


例如:

p_queue = ds_priority_create();
ini_open("save.ini");
var str = ini_read_string("P_Queues", "0", "");
if str != ""
   {
   ds_priority_read(p_queue, str);
   }
ini_close();

上面的代码创建了一个优先级队列,并将索引存储在变量“p_queue”中。然后打开一个ini file并从中读取一个字符串,检查以确保该字符串不会先返回为空。然后将该字符串读入新创建的ds_priority。


上一页: DS Priority Queues
下一页: ds_priority_write
© Copyright YoYo Games Ltd. 2018 All Rights Reserved